#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
	int l;
	char ch;
	scanf("%d\n%c", &l, &ch);
	double m[12][12];
	for (int i = 0; i < 12; i++)
	{
		for (int j = 0; j < 12; j++)
		{
			scanf("%lf", &m[i][j]);
		}
	}
	double sum = 0;
	for (int j = 0; j < 12; j++)
	{
		sum += m[l][j];
	}
	if (ch == 'S')
	{
		printf("%.1lf", sum);
	}
	else
	{
		printf("%.1lf", sum / 12);
	}
	return 0;
}